﻿#建议保存编码为：bom头 + utf8
param
(
	[parameter(Mandatory = $true)]
	[ValidateNotNullOrEmpty()]
	[Alias("cname")][String]$cluster名
)

if (Test-Path -LiteralPath ${cluster名})
{
	Set-Location "${PSScriptRoot}/${cluster名}"
}
else
{
	& "${PSScriptRoot}/Write-Error2.ps1"  '错误：没有这个cluster。退出码1'
	exit 1
}

Copy-Item -LiteralPath "${PSScriptRoot}/eds_1st.json" -Destination "${PSScriptRoot}/${cluster名}/eds.json"

$private:eds = Get-Content -LiteralPath "${PSScriptRoot}/${cluster名}/eds.json" | ConvertFrom-Json -Depth 99
foreach ($temp001 in $private:eds.resources)
{
	$temp001.cluster_name = $cluster名
}
$private:eds2 = $private:eds | ConvertTo-Json -Depth 99
Set-Content -LiteralPath "${PSScriptRoot}/${cluster名}/eds.json" -Value $private:eds2 -Encoding utf8NoBOM

Set-Location ..
exit 0
